/**
 * @description: 单例模式（SingleTon)
 * @author: huen2015
 */

class SingleTon {
	private static instance: SingleTon | null = null
	public name = 'SingleTon'
	public static getInstance() {
		if (SingleTon.instance == null) {
			SingleTon.instance = new SingleTon()
		}
		return SingleTon.instance
	}
}

const instance1 = SingleTon.getInstance()
const instance2 = SingleTon.getInstance()
console.log('单例模式（SingleTon)')
console.log('instance1 === instance2', instance1 === instance2) // true

export { SingleTon }
